/**
 * COPYRIGHT HangZhou Trustway Technology Company Limited
 * All right reserved.
 */
package com.robam.cloud.apicenter.service.impl;

import com.robam.cloud.apicenter.dao.SysDictTypeMapper;
import com.robam.cloud.apicenter.dao.SysDictValueMapper;
import com.robam.cloud.apicenter.service.SysDictService;
import com.robam.cloud.common.bean.apicenter.dto.SysDictValueDto;
import com.robam.cloud.common.bean.apicenter.entity.SysDictType;
import com.robam.cloud.common.bean.apicenter.entity.SysDictValue;
import com.robam.cloud.common.util.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description
 * @Author 薛铁琪
 * @CreateTime 2020-07-28 15:05
 * @Version 1.0
 */
@Service
public class SysDictServiceImpl implements SysDictService {
    @Autowired
    SysDictTypeMapper sysDictTypeMapper;
    @Autowired
    SysDictValueMapper sysDictValueMapper;

    @Override
    public List<SysDictType> getAllSysDictType() {
        return sysDictTypeMapper.selectAll();
    }

    @Override
    public List<SysDictValue> getSysDictValueByType(String dmlb) {
        return sysDictValueMapper.selectSysDictValueByType(dmlb);
    }

    @Override
    public List<SysDictValueDto> getSysDictValueDtoByType(String dmlb) {
        List<SysDictValue> sysDictValues = sysDictValueMapper.selectSysDictValueByType(dmlb);
        List<SysDictValueDto> sysDictValueDtos = BeanUtil.copyToList(sysDictValues, SysDictValueDto.class);
        return sysDictValueDtos;
    }
}
